
#ifndef SERIALPORT_H

#define SERIALPORT_H



#include <QObject>
#include <QMetaObject>
#include <QSerialPort>
#include <QSerialPortInfo>


class SerialPort : public QObject

{

    Q_OBJECT

public:

//    QString portName;
//    QString description;
//    QString manufacturer;
//    QString serialNumber;

    explicit SerialPort(QObject *parent = nullptr);
    explicit SerialPort(QString port,QString baudrate,QString databits,QString parity,QString stopbits);

    ~SerialPort();



    Q_INVOKABLE bool serialConnect(QString port,QString baudrate,QString databits,QString parity,QString stopbits);

    //Q_INVOKABLE QStringList querySerialInfo();

    Q_INVOKABLE QString serialRead();

    Q_INVOKABLE bool serialWrite(QString sendStr);



    QStringList PortNameStr();

signals:



public slots:

    void ReadBuf(const QString &s);

private:


};



#endif // SERIALPORT_H
